

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<script type="text/javascript" src="helpman_topicinit.js"></script>

<title>State Machine Diagram  [Enterprise Architect User Guide]</title>

<meta name="keywords" content="Enterprise Architect, Sparx Systems, UML, State,State Diagram,State Chart,State Machine Diagram,State Machine Diagram Description,State Machine Diagram Example,State Machine Diagram Elements And Connectors,State Machine Diagram Display Format,Diagram,Diagram State,Diagram State Machine">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta http-equiv="Content-Style-Type" content="text/css" />

<link type="text/css" href="default.css" rel="stylesheet" />
<style type="text/css">
  A, A:Visited
  {
    color: #00F;
  }

  A:Active, A:Hover
  {
    color: #F00;
  }

  OL
  {
    margin: 5px 0 5px 48px;
  }

  UL
  {
    margin-bottom: 3px;
    margin-top: 0;
  }

  #nsr
  {
    background-color: #D4DFFF;
  }

  #nsr A
  {
    text-decoration: none;
  }

  #mainbody
  {
    padding: 8px;
  }

  .p_BodyText
  {
    padding: 5px 0;
  }
</style>



<style type="text/css" media="screen">
  BODY
  {
    background-color: #FFFFFF;
  }

  #nsr
  {
    padding: 6px 6px 0 6px;
    border-bottom: none;
    vertical-align: top;
    z-index: 2;
    visibility: visible;
    left: 0;
    top: 0;
    position: absolute;
  }

  #mainbody
  {
    left: 0;
    top: 0;
    margin: 0;
    position: absolute;
    padding: 10px;
    overflow: auto;
    height: 100%;
    z-index: 1;
    background-repeat: no-repeat;
    background-position: bottom right;
    background-attachment: fixed;
  }
</style>

<style type="text/css" media="print">
  #nsr
  {
    visibility: none;
  }

  #mainbody
  {
    overflow: visible;
  }
</style>
<script type="text/javascript" language="JavaScript" src="nonscroll.js"></script>

</head>
<body scroll="no">

<div id="page">



        <div id="content">
          <div id="content-inner">
          



  
          <div id="nsr">
            <table border="0" cellspacing="0" cellpadding="4" width="100%">
              <tr valign="top">
                <td align="left">
  


                  <p class="p_Heading1"><span class="f_Heading1">State Machine Diagrams</span></p>



  
                </td>
                <td align="right">
                  <a href="introduction.htm" onmouseover="document.images.main.src='button_main_h.gif'" onmouseout="document.images.main.src='button_main.gif'">
                    <img name="main" src="button_main.gif" border=0 alt="Return to Introduction">
                  </a>&nbsp;
    
                  <a href="usecasediagram.htm" onmouseover="document.images.prev.src='button_prev_h.gif'" onmouseout="document.images.prev.src='button_prev.gif'">
                    <img name=prev src="button_prev.gif" border=0 alt="Previous page" />
                  </a>&nbsp;
    
    
    
                  <a href="regions.htm" onmouseover="document.images.next.src='button_next_h.gif'" onmouseout="document.images.next.src='button_next.gif'">
                    <img name=next src="button_next.gif" border=0 alt="Next page" />
                  </a>
    
    
                </td>
              </tr>
            </table>
          </div>
          <div id="mainbody">
  


                <div style="text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 5px 0px 5px 13px;"><table cellspacing="0" cellpadding="2" border="0" style="border: none; border-spacing:0px;">
<tr style="text-align:left;vertical-align:bottom;">
<td valign="bottom" width="955" bgcolor="#efeff7" style="width:955px; background-color:#efeff7;"><p class="p_TiporNote" style="border-top: none; border-right: none; border-left: none;"><span class="f_TiporNote">Note:</span></p>
</td>
</tr>
<tr style="text-align:left;">
<td width="955" bgcolor="#f7f7ff" style="width:955px; background-color:#f7f7ff;"><p class="p_TiporNoteText"><span class="f_TiporNoteText">State Machine diagrams were formerly known as State diagrams.</span></p>
</td>
</tr>
</table>
</div>
<p class="p_BodyText"><span class="f_BodyText">A </span><span class="f_BodyText" style="font-style: italic;">State Machine</span><span class="f_BodyText"> diagram illustrates how an element (often a Class) can move between states, classifying its behavior according to transition triggers and constraining guards. Other aspects of State Machine diagrams further depict and explain movement and behavior. State Machine representations in UML are based on the </span><span class="f_BodyText" style="font-style: italic;">Harel State Chart Notation</span><span class="f_BodyText"> (see the </span><span class="f_BodyText" style="font-style: italic;">OMG UML Superstructure Specification 2.1.1</span><span class="f_BodyText">, </span><span class="f_BodyText" style="font-style: italic;">section 15.1</span><span class="f_BodyText">), and therefore are sometimes referred to as </span><span class="f_BodyText" style="font-style: italic;">State Charts</span><span class="f_BodyText">.</span></p>
<p class="p_BodyText"><span class="f_BodyText">You can display a State Machine as a diagram (as below) or as a </span><span class="f_BodyText" style="font-style: italic;"><a href="state_table_diagram.htm">table</a></span><span class="f_BodyText"> in one of three relationship formats. In all formats, you use the same Enterprise Architect UML </span><span class="f_UIControl">Toolbox</span><span class="f_BodyText"> <a href="stategroup.htm">elements and connectors</a></span><span class="f_BodyText" style="font-style: italic;">.</span></p>
<p class="p_BodyText"><span class="f_BodyText">To select the display format, follow the steps below:</span></p>
<ol style="text-indent: 0px; margin-left: 48px; list-style-position: outside;">
<li value=1><span class="f_NumberedList">Right-click on the diagram background to display the context menu.</span></li>
<li value=2><span class="f_NumberedList">Select the </span><span class="f_MenuKeyField">Statechart Editor</span><span class="f_NumberedList"> option.</span></li>
<li value=3><span class="f_NumberedList">Select the appropriate display option:</span></li>
</ol>
<ul style="text-indent: 0px; margin-left: 65px; list-style-position: outside;">
<li><span class="f_MenuKeyField">Diagram</span></li>
<li><span class="f_MenuKeyField">Table (State-Next State)</span></li>
<li><span class="f_MenuKeyField">Table (State-Trigger)</span></li>
<li><span class="f_MenuKeyField">Table (Trigger-State)</span><span class="f_BodyText"> </span></li>
</ul>
<p class="p_SubHeadingL1"><span class="f_SubHeadingL1">Example Diagram</span></p>
<p class="p_BodyText"><span class="f_BodyText">The following diagram illustrates some features of State Machine diagrams. The </span><span class="f_BodyText" style="font-style: italic;">Saved</span><span class="f_BodyText"> State is a </span><span class="f_BodyText" style="font-style: italic;"><a href="compositestate.htm">Composite</a></span><span class="f_BodyText"> State, and enclosed States are </span><span class="f_BodyText" style="font-style: italic;"><a href="compositestate.htm">sub-states</a></span><span class="f_BodyText">. Initial and final <a href="pseudo_states.htm">pseudo-states</a> indicate the entry to and exit from the State Machine. Composite States and sub-states are both <a href="state.htm">State</a> elements, a Composite State being an expanded State element that encloses other State elements, which are then referred to as sub-states. Composite States and State Machines can also contain <a href="regions.htm">Regions</a>.</span></p>
<div style="text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 5px 0px 5px 13px;"><table cellspacing="0" cellpadding="2" border="0" style="border: none; border-spacing:0px;">
<tr style="text-align:left;vertical-align:bottom;">
<td valign="bottom" width="955" bgcolor="#efeff7" style="width:955px; background-color:#efeff7;"><p class="p_TiporNote" style="border-top: none; border-right: none; border-left: none;"><span class="f_TiporNote">Note:</span></p>
</td>
</tr>
<tr style="text-align:left;">
<td width="955" bgcolor="#f7f7ff" style="width:955px; background-color:#f7f7ff;"><p class="p_TiporNoteText"><span class="f_TiporNoteText">State elements can display either with or without a line across them. The line - as shown below - displays when the element has features such as attributes (which could be hidden) or when the </span><span class="f_MenuKeyField"><a href="objectappearance.htm">Show State Compartment</a></span><span class="f_TiporNoteText"> checkbox is selected in the </span><span class="f_UIControl">Objects </span><span class="f_TiporNoteText">page of the </span><span class="f_UIControl">Options</span><span class="f_TiporNoteText"> dialog.</span></p>
</td>
</tr>
</table>
</div>
<p class="p_TextIndentedL2"><img src="example%20of%20a%20state%20machine%20or%20state%20chart.png" width="669" height="653" border="0" alt="Example of a State Machine or State Chart"></p>
<p class="p_SubHeadingL1"><span class="f_SubHeadingL1">Toolbox Elements and Connectors</span></p>
<p class="p_BodyText"><span class="f_BodyText">Select State Machine diagram elements and connectors from the </span><span class="f_UIControl"><a href="stategroup.htm">State</a></span><span class="f_BodyText"><a href="stategroup.htm"> pages</a> of the Enterprise Architect UML</span><span class="f_UIControl"> Toolbox</span><span class="f_BodyText" style="font-style: italic;">.</span></p>
<div style="text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 5px 0px 5px 13px;"><table cellspacing="0" cellpadding="2" border="0" style="border: none; border-spacing:0px;">
<tr style="text-align:left;vertical-align:bottom;">
<td valign="bottom" width="955" bgcolor="#efeff7" style="width:955px; background-color:#efeff7;"><p class="p_TiporNote" style="border-top: none; border-right: none; border-left: none;"><span class="f_TiporNote">Tip:</span></p>
</td>
</tr>
<tr style="text-align:left;">
<td width="955" bgcolor="#f7f7ff" style="width:955px; background-color:#f7f7ff;"><p class="p_TiporNoteText"><span class="f_TiporNoteText">Click on the following elements and connectors for more information.</span></p>
</td>
</tr>
</table>
</div>
<div style="text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 5px 0px 5px 13px;"><table cellspacing="0" cellpadding="0" border="0" style="border: none; border-spacing:0px; border-collapse: collapse;">
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="214" bgcolor="#e3e6ed" style="width:214px; background-color:#e3e6ed; border: solid 1px #000000;"><p class="p_Tableheader"><span class="f_Tableheader">State Machine Diagram Elements</span></p>
</td>
<td valign="top" width="225" bgcolor="#e3e6ed" style="width:225px; background-color:#e3e6ed; border: solid 1px #000000;"><p class="p_Tableheader"><span class="f_Tableheader">State Machine Diagram Connectors</span></p>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="214" style="width:214px; border: solid 1px #000000;"><p class="p_Tabletext"><a href="state.htm"><img src="e_state.png" width="167" height="24" border="0" alt="e_State"></a></p>
</td>
<td valign="top" width="225" style="width:225px; border: solid 1px #000000;"><p class="p_Tabletext"><a href="forkjoin.htm"><img src="c_forkjoinacross.png" width="170" height="20" border="0" alt="c_ForkJoinAcross"></a></p>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="214" style="width:214px; border: solid 1px #000000;"><p class="p_Tabletext"><a href="submachine.htm"><img src="e_statemachine.png" width="165" height="24" border="0" alt="e_statemachine"></a></p>
</td>
<td valign="top" width="225" style="width:225px; border: solid 1px #000000;"><p class="p_Tabletext"><a href="forkjoin.htm"><img src="c_forkjoinup.png" width="170" height="24" border="0" alt="c_ForkJoinUp"></a></p>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="214" style="width:214px; border: solid 1px #000000;"><p class="p_Tabletext"><a href="initial.htm"><img src="e_initial.png" width="165" height="27" border="0" alt="e_Initial"></a></p>
</td>
<td valign="top" width="225" style="width:225px; border: solid 1px #000000;"><p class="p_Tabletext"><a href="transition.htm"><img src="c_transition.png" width="168" height="23" border="0" alt="c_Transition"></a></p>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="214" style="width:214px; border: solid 1px #000000;"><p class="p_Tabletext"><a href="final.htm"><img src="e_final.png" width="168" height="24" border="0" alt="e_Final"></a></p>
</td>
<td valign="top" width="225" style="width:225px; border: solid 1px #000000;"><p class="p_Tabletext"><a href="objectflow.htm"><img src="c_objectflow.png" width="170" height="23" border="0" alt="c_ObjectFlow"></a></p>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="214" style="width:214px; border: solid 1px #000000;"><p class="p_Tabletext"><a href="historystate.htm"><img src="e_history.png" width="167" height="22" border="0" alt="e_History"></a></p>
</td>
<td valign="top" width="225" style="width:225px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext">&nbsp;</span></p>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="214" style="width:214px; border: solid 1px #000000;"><p class="p_Tabletext"><a href="synch.htm"><img src="e_synch.png" width="170" height="23" border="0" alt="e_Synch"></a></p>
</td>
<td valign="top" width="225" style="width:225px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext">&nbsp;</span></p>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="214" style="width:214px; border: solid 1px #000000;"><p class="p_Tabletext"><a href="object.htm"><img src="e_object.png" width="167" height="22" border="0" alt="e_Object"></a></p>
</td>
<td valign="top" width="225" style="width:225px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext">&nbsp;</span></p>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="214" style="width:214px; border: solid 1px #000000;"><p class="p_Tabletext"><a href="choice.htm"><img src="e_choice.png" width="169" height="20" border="0" alt="e_Choice"></a></p>
</td>
<td valign="top" width="225" style="width:225px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext">&nbsp;</span></p>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="214" style="width:214px; border: solid 1px #000000;"><p class="p_Tabletext"><a href="junction.htm"><img src="e_junction.png" width="168" height="21" border="0" alt="e_Junction"></a></p>
</td>
<td valign="top" width="225" style="width:225px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext">&nbsp;</span></p>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="214" style="width:214px; border: solid 1px #000000;"><p class="p_Tabletext"><a href="entrypoints.htm"><img src="e_entry.png" width="168" height="24" border="0" alt="e_Entry"></a></p>
</td>
<td valign="top" width="225" style="width:225px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext">&nbsp;</span></p>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="214" style="width:214px; border: solid 1px #000000;"><p class="p_Tabletext"><a href="exitpoints.htm"><img src="e_exit.png" width="168" height="22" border="0" alt="e_Exit"></a></p>
</td>
<td valign="top" width="225" style="width:225px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext">&nbsp;</span></p>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="214" style="width:214px; border: solid 1px #000000;"><p class="p_Tabletext"><a href="terminate.htm"><img src="e_terminate.png" width="168" height="23" border="0" alt="e_Terminate"></a></p>
</td>
<td valign="top" width="225" style="width:225px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext">&nbsp;</span></p>
</td>
</tr>
</table>
</div>
<p class="p_SubHeadingL1"><span class="f_SubHeadingL1">OMG UML Specification</span></p>
<p class="p_BodyText"><span class="f_BodyText">The OMG UML specification (</span><span class="f_BodyText" style="font-style: italic;">UML Superstructure Specification, v2.1.1, Section 15.3.12, p. 560</span><span class="f_BodyText"> ) states:</span></p>
<p class="p_OMGText"><span class="f_OMGText">A state machine owns one or more regions, which in turn own vertices and transitions. </span></p>
<p class="p_OMGText"><span class="f_OMGText">The behaviored classifier context owning a state machine defines which signal and call triggers are defined for the state machine, and which attributes and operations are available in activities of the state machine. Signal triggers and call triggers for the state machine are defined according to the receptions and operations of this classifier. </span></p>
<p class="p_OMGText"><span class="f_OMGText">As a kind of behavior, a state machine may have an associated behavioral feature (specification) and be the method of this behavioral feature. In this case the state machine specifies the behavior of this behavioral feature. The parameters of the state machine in this case match the parameters of the behavioral feature and provide the means for accessing (within the state machine) the behavioral feature parameters. </span></p>
<p class="p_OMGText"><span class="f_OMGText">A state machine without a context classifier may use triggers that are independent of receptions or operations of a classifier, i.e. either just signal triggers or call triggers based upon operation template parameters of the (parameterized) state machine.</span></p>




            </div>
          </div>
        </div>



</div>


</body>
</html>
